/*
 * 侧边栏标签样式文件 - Sidebar Tags Styles
 * 定义侧边栏的布局、卡片样式、个人信息展示样式
 */

.sidebarTags {
  width: 400px;
  position: sticky;
  top: 100px;
  height: fit-content;

  .card {
    margin-bottom: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: all 0.3s ease;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);

    &:hover {
      box-shadow: 0 4px 16px var(--shadow-color);
      transform: translateY(-2px);
    }

    :global(.ant-card-head) {
      border-bottom: 1px solid var(--border-color);
      padding: 12px 16px;
      background-color: var(--bg-primary);

      :global(.ant-card-head-title) {
        font-size: 16px;
        font-weight: 600;
        color: var(--text-primary);
      }
    }

    :global(.ant-card-body) {
      padding: 16px;
      background-color: var(--bg-primary);
    }
  }

  .profile {
    background: linear-gradient(
      135deg,
      #e8d5f0 0%,
      #d1c4e9 25%,
      #c8e6c8 50%,
      #dcedc8 75%,
      #fff9c4 100%
    );
    background-size: 400% 400%;
    border-radius: 50px;
    padding: 36px;
    margin: 0 0 16px;
    position: relative;
    overflow: hidden;
    animation: gradient-shift 8s ease-in-out infinite;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: all 0.3s ease;

    &:hover {
      box-shadow: 0 4px 16px var(--shadow-color);
      transform: translateY(-2px);
    }

    &::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 30%) 0%,
        rgba(255, 255, 255, 15%) 50%,
        rgba(255, 255, 255, 8%) 100%
      );
      border-radius: 50px;
      animation: shimmer-effect 3s ease-in-out infinite alternate;
    }

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;

    :global(.ant-avatar) {
      margin-bottom: 12px;
      box-shadow: 0 8px 30px rgba(0, 0, 0, 15%), 0 4px 15px rgba(0, 0, 0, 10%),
        0 0 0 4px rgba(255, 255, 255, 80%);
      border: 4px solid rgba(255, 255, 255, 90%);
      position: relative;
      z-index: 2;
      transition: all 0.3s ease;

      &:hover {
        transform: scale(1.08);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 20%),
          0 6px 20px rgba(0, 0, 0, 15%), 0 0 0 6px rgba(255, 255, 255, 90%);
      }
    }

    .info {
      text-align: center;
      width: 100%;
      position: relative;
      z-index: 1;

      h3 {
        margin: 0 0 12px;
        font-size: 24px;
        font-weight: 700;
        color: #2c3e50;
        text-shadow: 0 1px 2px rgba(255, 255, 255, 80%);
      }

      p {
        margin: 6px 0;
        font-size: 15px;
        color: #34495e;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        text-shadow: 0 1px 1px rgba(255, 255, 255, 60%);

        :global(.anticon) {
          font-size: 14px;
        }
      }

      // 统计数据容器样式
      .statsContainer {
        display: flex;
        justify-content: space-around;
        align-items: center;
        margin-top: 16px;
        padding: 12px 0;

        .statItem {
          display: flex;
          flex-direction: column;
          align-items: center;
          gap: 6px;
          flex: 1;

          .statIcon {
            font-size: 16px;
            color: #34495e;
            margin-bottom: 4px;
          }

          .statNumber {
            font-size: 24px;
            font-weight: 700;
            color: #2c3e50;
            text-shadow: 0 1px 2px rgba(255, 255, 255, 80%);
            line-height: 1;
            margin: 2px 0;
          }

          .statLabel {
            font-size: 12px;
            color: #7f8c8d;
            font-weight: 500;
            text-shadow: 0 1px 1px rgba(255, 255, 255, 60%);
            margin-top: 2px;
          }
        }
      }
    }
  }

  // 天气卡片样式
  .weatherCard {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #2563eb 100%);
    border: none;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 30%);
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 20px rgba(79, 70, 229, 40%);
    }

    // 黑夜模式下的样式 - 深紫红色调
    @media (prefers-color-scheme: dark) {
      background: linear-gradient(
        135deg,
        #6366f1 0%,
        #8b5cf6 50%,
        #a855f7 100%
      );
      box-shadow: 0 4px 15px rgba(139, 92, 246, 30%);

      &:hover {
        box-shadow: 0 6px 20px rgba(139, 92, 246, 40%);
      }
    }

    // 支持手动设置的暗色主题
    html[data-theme='dark'] &,
    :global(html[data-theme='dark']) & {
      background: linear-gradient(
        135deg,
        #6366f1 0%,
        #8b5cf6 50%,
        #a855f7 100%
      );
      box-shadow: 0 4px 15px rgba(139, 92, 246, 30%);

      &:hover {
        box-shadow: 0 6px 20px rgba(139, 92, 246, 40%);
      }
    }

    &::before {
      content: '';
      position: absolute;
      top: -50%;
      left: -50%;
      width: 200%;
      height: 200%;
      background: radial-gradient(
        circle,
        rgba(255, 255, 255, 8%) 0%,
        rgba(255, 255, 255, 0%) 70%
      );
      animation: shimmer 15s infinite linear;
      pointer-events: none;
      z-index: 1;
    }

    // 重写antd Card的内容区域样式
    :global(.ant-card-body) {
      background: transparent;
      padding: 24px;
      position: relative;
      z-index: 2;
    }
  }

  // 天气容器样式
  .weatherContainer {
    color: #fff;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    position: relative;
    height: 60px; // 默认收缩状态高度

    // 收缩状态
    &.collapsed {
      height: 60px;

      .collapsedContent {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
        padding: 12px 16px;
        opacity: 1;
        transform: translateY(0);
        transition: all 0.4s ease;
      }

      .expandedContent {
        opacity: 0;
        transform: translateY(20px);
        transition: all 0.3s ease;
        pointer-events: none;
      }
    }

    // 展开状态
    &.expanded {
      height: 450px; // 恢复原来的高度

      .collapsedContent {
        opacity: 0;
        transform: translateY(-20px);
        transition: all 0.3s ease;
        pointer-events: none;
      }

      .expandedContent {
        opacity: 1;
        transform: translateY(-10px); // 向上移动10px，让内容更紧凑
        transition: all 0.5s ease 0.1s; // 延迟0.1s开始展开内容
        pointer-events: auto;
        padding: 8px 0; // 减少内边距，让内容更紧凑
      }
    }

    // 收缩状态的内容样式
    .collapsedContent {
      .locationCompact {
        font-size: 14px;
        font-weight: 500;
        margin-bottom: 4px;
        text-align: center;
        opacity: 0.9;
      }

      .weatherCompact {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;

        .weatherIconCompact {
          font-size: 24px;
          filter: drop-shadow(0 0 8px rgba(220, 220, 255, 40%));
        }

        .temperatureCompact {
          font-size: 20px;
          font-weight: 600;
          background: linear-gradient(to right, #fff, #e2e8f0);
          background-clip: text;
          -webkit-text-fill-color: transparent;
          background-clip: text;
        }
      }
    }

    // 展开状态的内容样式
    .expandedContent {
      position: relative;
      top: 0;

      .weatherHeader {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        margin-bottom: 8px; // 减少间距
        animation: slide-in-down 0.4s ease-out 0.2s both;

        .weatherIcon {
          font-size: 18px;
          color: #fff;
        }

        .weatherTitle {
          font-size: 18px;
          font-weight: 600;
          color: #fff;
        }
      }

      .currentTime {
        margin-bottom: 4px; // 减少间距
        animation: slide-in-down 0.4s ease-out 0.3s both;
      }

      .currentWeather {
        margin-bottom: 6px; // 减少间距
        animation: slide-in-down 0.4s ease-out 0.4s both;
      }

      .location {
        margin-bottom: 8px; // 减少间距
        animation: slide-in-down 0.4s ease-out 0.5s both;
      }

      .sunInfo {
        margin-bottom: 8px; // 减少间距
        animation: slide-in-down 0.4s ease-out 0.6s both;
      }

      .weatherDetails {
        margin-bottom: 10px; // 减少间距
        animation: slide-in-down 0.4s ease-out 0.7s both;
      }

      .forecast {
        animation: slide-in-down 0.4s ease-out 0.8s both;
      }
    }

    .currentTime {
      font-size: 12px;
      font-weight: 300;
      opacity: 0.8;
      margin-bottom: 8px;
      text-align: center;
      animation: fade-in-up 0.6s ease-out forwards;
    }

    .currentWeather {
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 12px;
      animation: fade-in-up 0.6s ease-out 0.1s forwards;
      opacity: 0;

      .weatherIconMain {
        font-size: 48px;
        margin-right: 12px;
        filter: drop-shadow(0 0 12px rgba(220, 220, 255, 50%));
        animation: floating 3.5s ease-in-out infinite;
      }

      .temperature {
        font-size: 48px;
        font-weight: 600;
        background: linear-gradient(to right, #fff, #e2e8f0);
        background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
      }
    }

    .location {
      font-size: 16px;
      margin-bottom: 16px;
      text-align: center;
      animation: fade-in-up 0.6s ease-out 0.2s forwards;
      opacity: 0;
    }

    .sunInfo {
      background: rgba(0, 0, 0, 30%);
      backdrop-filter: blur(10px);
      border-radius: 16px;
      padding: 12px 16px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 16px;
      border: 1px solid rgba(255, 255, 255, 10%);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 20%);
      animation: fade-in-up 0.6s ease-out 0.3s forwards;
      opacity: 0;

      .sunrise,
      .sunset {
        text-align: center;

        .sunIcon {
          font-size: 18px;
          margin-bottom: 4px;
          transition: transform 0.3s ease-in-out;

          &:hover {
            transform: rotate(15deg) scale(1.15);
          }
        }

        .sunTime {
          font-size: 11px;
          opacity: 0.8;
        }
      }

      .dayLength {
        text-align: center;
        font-size: 13px;
        opacity: 0.9;
      }
    }

    .weatherDetails {
      display: flex;
      justify-content: space-between;
      font-size: 13px;
      margin-bottom: 20px;
      animation: fade-in-up 0.6s ease-out 0.4s forwards;
      opacity: 0;
    }

    .forecast {
      display: flex;
      justify-content: space-between;
      gap: 8px;

      .forecastDay {
        background: rgba(255, 255, 255, 5%);
        backdrop-filter: blur(10px);
        border-radius: 12px;
        padding: 12px 8px;
        text-align: center;
        border: 1px solid rgba(255, 255, 255, 10%);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 10%);
        transition: all 0.2s ease;
        cursor: pointer;
        flex: 1;
        animation: fade-in-up 0.6s ease-out forwards;
        opacity: 0;

        &:nth-child(1) {
          animation-delay: 0.5s;
        }

        &:nth-child(2) {
          animation-delay: 0.6s;
        }

        &:nth-child(3) {
          animation-delay: 0.7s;
        }

        &:nth-child(4) {
          animation-delay: 0.8s;
        }

        &:hover {
          background: rgba(255, 255, 255, 10%);
          transform: translateY(-2px);
          box-shadow: 0 0 25px rgba(255, 255, 255, 10%),
            0 4px 10px rgba(0, 0, 0, 20%);

          .forecastIcon {
            transform: scale(1.2) translateY(-2px);
          }
        }

        .dayName {
          font-size: 11px;
          font-weight: 500;
          margin-bottom: 4px;
          opacity: 0.8;
        }

        .forecastIcon {
          font-size: 20px;
          margin: 4px 0;
          filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 30%));
          transition: transform 0.3s ease-out;
        }

        .highTemp {
          font-size: 13px;
          font-weight: 600;
          background: linear-gradient(to right, #fff, #e2e8f0);
          background-clip: text;
          -webkit-text-fill-color: transparent;
          background-clip: text;
        }

        .lowTemp {
          font-size: 11px;
          opacity: 0.7;
        }
      }
    }
  }

  // 计时器卡片样式
  .timerCard {
    background: linear-gradient(135deg, #f5ab3d 0%, #ee9d52 100%);
    border: none;
    border-radius: 18px;
    box-shadow: 0 4px 15px rgba(196, 144, 96, 25%);
    transition: all 0.3s ease;
    overflow: hidden;

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 20px rgba(196, 144, 96, 35%);
    }

    // 黑夜模式下的样式
    @media (prefers-color-scheme: dark) {
      background: linear-gradient(135deg, #4a90e2 0%, #5ba3f5 100%);
      box-shadow: 0 4px 15px rgba(74, 144, 226, 25%);

      &:hover {
        box-shadow: 0 6px 20px rgba(74, 144, 226, 35%);
      }
    }

    // 支持手动设置的暗色主题
    html[data-theme='dark'] &,
    :global(html[data-theme='dark']) & {
      background: linear-gradient(135deg, #4a90e2 0%, #5ba3f5 100%);
      box-shadow: 0 4px 15px rgba(74, 144, 226, 25%);

      &:hover {
        box-shadow: 0 6px 20px rgba(74, 144, 226, 35%);
      }
    }

    // 重写antd Card的内容区域样式
    :global(.ant-card-body) {
      background: transparent;
      padding: 20px 16px;
    }
  }

  // 计时器容器样式
  .timerContainer {
    text-align: center;
    color: #fff;

    .timerHeader {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      margin-bottom: 18px;

      .timerIcon {
        font-size: 20px;
        color: #fff;
      }

      .timerTitle {
        font-size: 20px;
        font-weight: 600;
        color: #fff;
      }
    }

    // 翻转时钟样式
    .flipClock {
      position: relative;
      font-family: var(--global-font) !important;
      font-size: 1.6rem;
      line-height: 1.2;
      margin-bottom: 16px;
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 1px;

      .timeSeparator {
        color: #fff;
        margin: 0 0.05em;
        font-size: 0.75em;
        font-weight: 600;
      }

      .flipDigit {
        position: relative;
        display: inline-block;
        padding: 0.05em 0.2em;
        margin: 0 0.04em;
        z-index: 1;
        min-width: 1em;
        text-align: center;
        transform: perspective(750px);
        transform-style: preserve-3d;

        &:first-child {
          margin-left: 0;
        }

        &:last-child {
          margin-right: 0;
        }

        &::before,
        &::after {
          position: absolute;
          left: 0;
          top: 0;
          right: 0;
          bottom: 0;
          color: #fff;
          text-shadow: 0 1px 2px rgba(0, 0, 0, 50%);
          background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
          border-radius: 0.2em;
          outline: 1px solid transparent;
          border: 1px solid rgba(255, 255, 255, 10%);
          box-shadow: 0 2px 6px rgba(0, 0, 0, 30%);
          backface-visibility: hidden;
          transition: transform 0.75s, opacity 0.75s;
        }

        &::before {
          opacity: 1;
          z-index: 1;
          content: attr(data-old);
          transform-origin: 0 0;
          transform: translate3d(0, 0, 0) rotateX(0);
        }

        &::after {
          opacity: 0;
          z-index: 2;
          content: attr(data-now);
          transform-origin: 0 100%;
          transform: translate3d(0, -102.5%, 0) rotateX(90deg);
        }

        &.flip::before {
          opacity: 0;
          transform: translate3d(0, 102.5%, 0) rotateX(-90deg);
        }

        &.flip::after {
          opacity: 1;
          transform: translate3d(0, 0, 0) rotateX(0);
        }
      }
    }

    .startTimeInfo {
      font-size: 12px;
      color: rgba(255, 255, 255, 70%);
      background: rgba(255, 255, 255, 10%);
      padding: 7px 14px;
      border-radius: 14px;
      display: inline-block;
      backdrop-filter: blur(10px);
    }
  }

  // 标签卡片样式
  .tagCard {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 30%);
    transition: all 0.3s ease;

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 20px rgba(102, 126, 234, 40%);
    }

    // 黑夜模式下的样式 - 深绿青色调
    @media (prefers-color-scheme: dark) {
      background: linear-gradient(
        135deg,
        #059669 0%,
        #0d9488 50%,
        #0891b2 100%
      );
      box-shadow: 0 4px 15px rgba(5, 150, 105, 30%);

      &:hover {
        box-shadow: 0 6px 20px rgba(5, 150, 105, 40%);
      }
    }

    // 支持手动设置的暗色主题
    html[data-theme='dark'] &,
    :global(html[data-theme='dark']) & {
      background: linear-gradient(
        135deg,
        #059669 0%,
        #0d9488 50%,
        #0891b2 100%
      );
      box-shadow: 0 4px 15px rgba(5, 150, 105, 30%);

      &:hover {
        box-shadow: 0 6px 20px rgba(5, 150, 105, 40%);
      }
    }

    // 卡片标题样式
    .cardTitle {
      display: flex;
      align-items: center;
      gap: 8px;
      color: #fff;
      font-weight: 600;

      .titleIcon {
        font-size: 16px;
        color: #fff;
      }
    }

    // 重写antd Card的标题样式
    :global(.ant-card-head) {
      background: transparent;
      border-bottom: 1px solid rgba(255, 255, 255, 20%);

      :global(.ant-card-head-title) {
        color: #fff;
        font-size: 14px;
      }
    }

    // 重写antd Card的内容区域样式
    :global(.ant-card-body) {
      background: transparent;
      padding: 16px;
    }
  }

  // 标签容器样式
  .tagsContainer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;

    // 标签项样式
    .tagItem {
      cursor: pointer;
      border: none;
      border-radius: 18px;
      padding: 8px 16px;
      font-size: 14px;
      font-weight: 500;
      background: rgba(255, 255, 255, 90%);
      color: #333;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: 0 2px 4px rgba(0, 0, 0, 10%);
      min-height: 32px;
      display: flex;
      align-items: center;

      &:hover {
        transform: translateY(-2px) scale(1.05);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 20%);
        background: rgba(255, 255, 255, 100%);
        color: #667eea;
        border-color: transparent;
      }

      &:active {
        transform: translateY(-1px) scale(1.02);
      }

      // 黑夜模式下标签项的样式
      @media (prefers-color-scheme: dark) {
        background: rgba(255, 255, 255, 95%);
        color: #1f2937;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 20%);

        &:hover {
          background: rgba(255, 255, 255, 100%);
          color: #059669;
          box-shadow: 0 4px 16px rgba(0, 0, 0, 30%);
        }
      }

      // 支持手动设置的暗色主题
      html[data-theme='dark'] &,
      :global(html[data-theme='dark']) & {
        background: rgba(255, 255, 255, 95%);
        color: #1f2937;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 20%);

        &:hover {
          background: rgba(255, 255, 255, 100%);
          color: #059669;
          box-shadow: 0 4px 16px rgba(0, 0, 0, 30%);
        }
      }
    }

    // 空状态样式
    .emptyState {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 20px;
      color: rgba(255, 255, 255, 70%);
      font-size: 12px;
      width: 100%;

      .emptyIcon {
        font-size: 24px;
        margin-bottom: 8px;
        opacity: 0.5;
      }
    }
  }
}

@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }

  25% {
    background-position: 100% 50%;
  }

  50% {
    background-position: 100% 100%;
  }

  75% {
    background-position: 0% 100%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@keyframes shimmer-effect {
  0% {
    opacity: 0.3;
    transform: translateX(-100%) skewX(-15deg);
  }

  50% {
    opacity: 0.6;
    transform: translateX(0%) skewX(-15deg);
  }

  100% {
    opacity: 0.3;
    transform: translateX(100%) skewX(-15deg);
  }
}

@keyframes shimmer {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@keyframes floating {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }

  100% {
    transform: translateY(0);
  }
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-in-down {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .sidebarTags {
    width: 240px;
  }
}

@media (max-width: 992px) {
  .sidebarTags {
    display: none;
  }
}
